define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: "bdl/bd/bizperson/index",
                    multi_url: 'bdl/bd/bizperson/multi',
                    export_url: 'bdl/bd/bizperson/export',
                    table: "bd_bizperson"
                }
            });

            var table = $("#table");
            var showExport  = $(".btn-export").data('value')

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                sortName: 'id',
                pk: 'id',
                escape: false,
                showToggle: false,
                showExport: showExport,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: 'ID',operate:false},
                        {
                            field: 'forgid', title: __('数据中心/组织'), searchList: function (column) {
                                return Template('forgidtpl', {});
                            }, formatter: function (value, row, index) {
                                return '无';
                            }, visible: false
                        },
                        {field: 'fnumber', title: '编码', operate:false},
                        {field: 'fname', title: '名称', operate:false},
                        {field: 'fk_bdl_phone', title: '手机号', operate:false},

                        {field: 'fenable', title: '使用状态', searchList: {"1":'可用',"0":'禁用'}, formatter: Table.api.formatter.status}  ,
                        {field: 'fk_bdl_bizpersontype', title: '业务员类型', searchList: {"XSY":'销售员',"CGY":'采购员',"CHY":'仓管员',"JHY":'计划员',"CWRY":'财务人员',"ZJY":'质检员',"FWRY":'服务人员',"JSY":'驾驶人员',"CSY":'程序员'}, formatter: Table.api.formatter.status}  ,


                        {field: 'fk_bdl_bdgroup', title: '业务组ID',visible:false,searchList: $.getJSON("bdl/bd/datacenter/getFilter?type=get_biz_list")},
                        {field: 'biz.fname', title: '业务组名称',operate: false},

                        {field: 'datacenter.fname', title: '数据中心名称',operate: false},
                        {field: 'forg.fname', title: '组织名称',operate: false},
                        {field: 'forg.fnumber', title: '组织编码',operate: false},
                        {field: 'forg.id', title: '组织ID',operate: false},




                        // {field: 'fk_bdl_comment', title: '备注', operate: 'LIKE'},
                        {field: 'fk_bdl_creatorid', title: '创建人',visible:false,searchList: $.getJSON("bdl/bd/datacenter/getFilter?type=get_admin_list")},
                        {field: 'creator.nickname', title: '创建人', operate: false},
                        {field: 'fk_bdl_createtime', title: '创建时间', operate:'RANGE', addclass:'datetimerange', autocomplete:false},
                        {field: 'fk_bdl_fmodifierid', title: '修改人',visible:false,searchList: $.getJSON("bdl/bd/datacenter/getFilter?type=get_admin_list")},
                        {field: 'modifier.nickname', title: '修改人', operate: false},
                        {field: 'fk_bdl_modifytime', title: '修改时间', operate:'RANGE', addclass:'datetimerange', autocomplete:false}
                    ]
                ],
                search: false,
            });

            // 为表格绑定事件
            Table.api.bindevent(table);


        },

    };


    return Controller;
});
